game_manager
{
	spawn
	{
		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 5
		wm_set_round_timelimit	15

		// Objectives
		// 1: Destroy the Old City Door
		// 2: Capture the Old City
		// 3&4: Steal the Documents
		// 5: Transmit the Documents

		wm_set_main_objective		1	0
		wm_set_main_objective		1	1

		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_objective_status 4 1 0
		wm_objective_status 4 0 0
		wm_objective_status 5 1 0
		wm_objective_status 5 0 0

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0

		accum 1 set 0		// Set counter for radar equipment


		wait 150
		setautospawn "Allied Hideout" 1
		setautospawn "Old City" 0

		setstate allieswin1 invisible
		setstate allieswin2 invisible
		setstate southdocs_cm invisible
		setstate northdocs_cm invisible
		setstate cm_southdoc invisible
		setstate cm_northdoc invisible
		// wait for everything to settle
		wait 500
		setstate bigdoor invisible
		setstate spawnflag invisible

	}

	trigger stolen_circuit
	{
		accum 1 inc 1				// One circuit board home
		trigger game_manager checkgame		// Check for end of game
	}

	trigger checkgame
	{
		accum 1 abort_if_not_equal 2
		wm_announce "Allies have transmitted both Documents!"
		wm_objective_status 5 0 2
		wm_objective_status 5 1 1

		wm_setwinner 1
		wait 1000
		wm_endround
	}
}

// ================================================
// ============== RADAR DISH MISC =================
// ================================================

southdocs
{
	spawn
	{
	remove
	}

	trigger stolen
	{
		wm_objective_status 4 0 2
		wm_objective_status 4 1 1
		wm_set_main_objective		5	0
		wm_set_main_objective		5	1
		setstate southdocs_cm invisible
		setstate cm_southdoc invisible
	}

	trigger returned
	{
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_set_main_objective		3	0
		wm_set_main_objective		3	1
		setstate southdocs_cm default
		setstate cm_southdoc default
	}

	trigger captured
	{
		wm_announce "Allies have transmitted the South Documents!"
		wm_teamvoiceannounce 1 "karsiah_allies_obj_sec"
		wm_teamvoiceannounce 0 "karsiah_axis_obj_lost"
		setstate allieswin1 default
		trigger game_manager stolen_circuit
	}
}

northdocs
{
	spawn
	{
	remove
	}


	trigger stolen
	{
		wm_objective_status 3 0 2
		wm_objective_status 3 1 1
		wm_set_main_objective		5	0
		wm_set_main_objective		5	1
		setstate northdocs_cm invisible
		setstate cm_northdoc invisible
	}

	trigger returned
	{
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_set_main_objective		3	0
		wm_set_main_objective		3	1
		setstate northdocs_cm default
		setstate cm_northdoc default
	}


	trigger captured
	{
		wm_announce "Allies have transmitted the North Documents!"
		wm_teamvoiceannounce 1 "karsiah_allies_obj_sec"
		wm_teamvoiceannounce 0 "karsiah_axis_obj_lost"
		setstate allieswin2 default
		trigger game_manager stolen_circuit
	}
}

bigdoor
{
	spawn
	{
		wait 200
		remove
	}

	death
	{
	}
}

spawnflag
{
	spawn
	{
		accum 0 set 0
		remove
	}

	trigger axis_capture
	{

	}

	trigger allied_capture
	{
	}

	trigger check_obj
	{
		accum 0 abort_if_equal 1
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1

		alertentity middlespawn
		alertentity middlespawns

		setautospawn "Old City" 1
		setautospawn "Backyard" 0

	}

	trigger kill
	{
		remove
	}
}